﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Examples
{
    /// <summary>
    /// Prints the download urls of all files in document library, 
    /// which can be used in when calling procedures, such as DOWNLOAD(..) and UPLOAD(..)
    /// </summary>
    class PrintDocumentLibraryUrls
    {
        public static void DoIt(string connectionString)
        {
            using (var connection = new Camelot.SharePointConnector.Data.SharePointConnection(connectionString))
            {
                connection.Open();

                var data = Camelot.SharePointIntegration.DocumentLibraryDataUtility.CreateDocumentLibraryData("Shared Documents", null, connection);

                foreach (var doc in data.Documents)
                {
                    if (doc.ContentType != "Folder")
                    {
                        Console.WriteLine(doc.ProcedureUrl);
                    }
                }
            }
        }
    }
}
